<script setup>
	import {
		defineProps
	} from "vue"
	const title = 'LingExerciseCard'
	defineProps({
		localdata: Array
	})
	const emit = defineEmits(['cancel', 'success', 'click1'])
	
	const onClickCancel = () => {
		emit('cancel')
	}
	const onClick = () => {
		emit('success')
	}
	const onClickItem = (i) => {
		emit('click1', i)
	}
</script>
<template>
	<view class="cover" @click.stop="" @touchmove.prevent="">
		<view class="d-card">
			<view style="text-align: center;">
				<text>答题卡</text>
			</view>
			<view style="position: absolute;top: 0;right: 0;padding: 30rpx;" @click="onClickCancel">✖</view>
			<view style="display: flex;flex-direction: row-reverse;padding: 30rpx;">
				<view class="d-label">
					<view style="border: solid 2rpx black;"></view>
					<text> 未作答</text>
				</view>
				<view class="d-label" style="margin-right: 18rpx;">
					<view style="background-color: #6888cc;border: solid 2rpx #6888cc;"></view>
					<text> 已作答</text>
				</view>
			</view>
			<view style="padding: 10rpx 30rpx;max-height: 40vh;min-height: 30vh;">
				<scroll-view scroll-y style="max-height: 40vh;min-height: 30vh;">
					<view style="display: flex;gap: 20rpx;flex-wrap: wrap;justify-content: flex-start;">
						<view v-for="(it, i) in localdata" :key="i" class="d-item"
							:class="it.isEdit ? 'd-item-active': 'd-item-deactive'" @click="onClickItem(i)">
							<text>{{i+1}}</text>
						</view>
					</view>
				</scroll-view>
			</view>
			<view style="height: 2rpx;background-color: #f3f3f3;"></view>
			<view style="padding:20rpx 30rpx;">
				<view style="background-color: #6888cc;padding:20rpx 0;text-align: center;" @click="onClick">
					<text style="color: white;font-size: 38rpx;">提交</text>
				</view>
			</view>
			<view style="height: 30rpx;"></view>
		</view>
	</view>
</template>
<style scoped lang="scss">
	$itemW: 80rpx;
	
	.cover {
		background-color: rgba(0, 0, 0, 0.3);
		width: 100%;
		height: 100%;
		position: absolute;
		top: 0;
		left: 0;
		z-index: 11;
	}
	
	.d-card {
		position: absolute;
		bottom: 0;
		left: 0;
		width: 100%;
		padding: 30rpx 0;
		background-color: white;
	}
	
	.d-label {
		display: flex;
		align-items: center;
	
		view {
			width: 10rpx;
			height: 10rpx;
			border-radius: 50%;
			margin-top: 4rpx;
			margin-right: 6rpx;
		}
	
		text {
			color: #7b7b7b;
			font-size: 20rpx;
		}
	}
	
	.d-item {
		width: $itemW;
		height: $itemW;
		text-align: center;
		line-height: $itemW;
		background-color: #6888cc;
		border-radius: 50%;
	}
	
	.d-item-active {
		background-color: #6888cc;
	
		text {
			color: white;
		}
	}
	
	.d-item-deactive {
		background-color: #f3f3f3;
	
		text {
			color: #7c7c7c;
		}
	}
</style>